home *** CD-ROM | disk | FTP | other *** search
- Path: news.oanet.com!usenet
- From: sunrise@oanet.com (sunrise)
- Newsgroups: comp.lang.c++
- Subject: ??:Re:'Scanf("%p%*c",&p) and Memory
- Date: 4 Feb 1996 21:39:09 GMT
- Organization: OA Internet
- Message-ID: <4f391t$2rg@hermes.oanet.com>
- NNTP-Posting-Host: dialin60.oanet.com
- X-Newsreader: WinVN 0.92.6+
-
-
-
- Hi. I'm working on a problem which takes an address (large memory model)
- from a user and displays its memory contents in Hex. I've found an
- example which uses the folowing but I don't understand the scanf.
-
- register int i;
- unsigned char far *p;
- unsigned ch;
-
- scanf("%p%*c",&p);
-
- for (i=1;i<=256;i++){
- ch=*p;
- printf("%02x ",ch);
- p++; }
-
- The program does essentially what I want, but I need to know...
- What does the "%p%*c" within the scanf do??? How does it work???
- Also how can I increment the p pointer so that the segment increaces
- and not just the offset (as the above example does).
-
- -Sunrise
-